import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class Input extends StatefulWidget {
  final callBackMobile;
  final callBackPassword;

  const Input({Key key, this.callBackMobile, this.callBackPassword})
      : super(key: key);

  @override
  State<Input> createState() => _InputState();
}

class _InputState extends State<Input> {
  TextEditingController mobile = TextEditingController();
  TextEditingController password = TextEditingController();
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: [
          Row(
            children: [
              Container(
                margin: EdgeInsets.only(right: 10),
                child: Image.asset(
                  'images/login/phone.png',
                  width: 20,
                  height: 20,
                ),
              ),
              Expanded(
                child: TextField(
                  maxLength: 11,
                  controller: mobile,
                  inputFormatters: [FilteringTextInputFormatter.digitsOnly],
                  onChanged: (v) {
                    widget.callBackMobile(v);
                  },
                  decoration: InputDecoration(
                    counterText: '',
                    border: OutlineInputBorder(borderSide: BorderSide.none),
                    hintText: '请输入手机号',
                  ),
                ),
              )
            ],
          ),
          Container(
            color: Color.fromRGBO(225, 225, 225, 1),
            height: 1,
          ),
          // TextButton(
          //     onPressed: () {

          //       widget.callBack(this.mobile.text);
          //     },
          //     child: Text('传值')),
          Row(
            children: [
              Container(
                margin: EdgeInsets.only(right: 10),
                child: Image.asset(
                  'images/login/password.png',
                  width: 20,
                  height: 20,
                ),
              ),
              Expanded(
                child: TextField(
                  obscureText: true,
                  controller: password,
                  onChanged: (val) {
                    widget.callBackPassword(val);
                  },
                  decoration: InputDecoration(
                    border: OutlineInputBorder(borderSide: BorderSide.none),
                    hintText: '请输入密码',
                  ),
                ),
              )
            ],
          ),
        ],
      ),
    );
  }
}
